import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/source/line_info.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:lpg2/src/Protocol.dart';

import 'package:snooperlang/src/snooperParser.dart';
/// Clients may not extend, implement or mix-in this class.
typedef  AstNode  = ASTNode;

abstract class Directive   {
  /// Return the element associated with this directive, or `null` if the AST
  /// structure has not been resolved or if this directive could not be
  /// resolved.
  Element? get element;



  late ASTNode node;
}
/// Clients may not extend, implement or mix-in this class.
abstract class UriBasedDirective implements Directive {
  /// Return the URI referenced by this directive.
  String get uri;

  /// Return the content of the [uri], or `null` if the AST structure has not
  /// been resolved, or if the [uri] has a string interpolation.
  String? get uriContent;

  /// Return the element associated with the [uri] of this directive, or `null`
  /// if the AST structure has not been resolved or if the URI could not be
  /// resolved.
  ///
  /// Examples of the latter case include a directive that contains an invalid
  /// URL or a URL that does not exist.
  Element? get uriElement;

  /// Return the source to which the [uri] was resolved.
  Source? get uriSource;
}

/// A node that represents a directive that impacts the namespace of a library.

abstract class NamespaceDirective implements UriBasedDirective {

  @override
  LibraryElement? get uriElement;
}
abstract class ImportDirective implements NamespaceDirective {
  @override
  ImportElement? get element;

}
abstract class CompilationUnit {

  int get length  {
    return rootAst!.getLeftIToken().getEndOffset();
  }


  int get offset => 0;
  SnooperProg? rootAst;
  List<ASTNode> nodes=[];
   List<Directive> directives=[];
  CompilationUnit(SnooperProg? node): rootAst=node{
    if(node == null)return;
    nodes = node.getSnooperSegments().list.content.cast<ASTNode>();
    //directives = nodes.whereType<LoadScriptStmt>().toList();
  }
  /// Return the element associated with this compilation unit, or `null` if the
  /// AST structure has not been resolved.
  CompilationUnitElement? get declaredElement;

  /// Return the line information for this compilation unit.
  late LineInfo  lineInfo;


  /// The set of features available to this compilation unit.
  ///
  /// Determined by some combination of the .packages file, the enclosing
  /// package's SDK version constraint, and/or the presence of a `@dart`
  /// directive in a comment at the top of the file.
  FeatureSet get featureSet;


}